﻿using System.Collections.Generic;
using Abp.Domain.Values;
using System.ComponentModel.DataAnnotations;

namespace NetCore.ValueObjects
{
    /// <summary>
    /// 地址(值类型地址)
    /// </summary>
    public class Address : ValueObject//<Address>
    {
        ///// <summary>
        ///// 无参构造函数
        ///// </summary>
        //public Address() { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="detail">详细地址 门牌号</param>
        /// <param name="village">村</param>
        /// <param name="street">街道</param>
        /// <param name="area">区/县</param>
        /// <param name="city">城市/自治区/特区/港澳台</param>
        /// <param name="province">省市/自治区/直辖市/特区/港澳台</param>
        /// <param name="country">国家</param>
        /// <param name="zipCode">邮政编码</param>
        /// <param name="code">位置区域代码 --过滤数据用</param>
        public Address(
            string detail = "",
            string village="",
            string street = "",
            string area = "",
            string city = "",
            string province = "",
            string country = "",
            string zipCode = "",
            string code = "")
        {
            Detail = detail;
            Village = village;
            Street = street;
            Area = area;
            City = city;
            Province = province;
            Country = country;
            ZipCode = zipCode;
            Code = code;
        }
        /// <summary>
        /// 位置区域代码 Key？？？
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength64)]
        public string Code { get; set; }
        /// <summary>
        /// 邮编
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength64)]
        public string ZipCode { get; set; }
        /// <summary>
        /// 国家
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string Country { get; set; }
        /// <summary>
        /// 省/直辖市/自治区 州State
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string Province { get; set; }
        /// <summary>
        /// 城市/市/(特/自治)区
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string City { get; set; }
        /// <summary>
        /// 区/县 Area/County
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string Area { get; set; }
        /// <summary>
        /// 街道
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string Street { get; set; }
        /// <summary>
        /// 村
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string Village { get; set; }
        /// <summary>
        /// 详细地址(小区-楼栋-门牌号)
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength128)]
        public string Detail { get; set; }
        /// <summary>
        /// 完整地址 扩展字段
        /// </summary>
        [MaxLength(NetCoreConsts.MaxLength512)]
        public string FullName { get; set; }

        /// <summary>
        /// 新版本中需要继承这个返回值对象列表
        /// </summary>
        /// <returns></returns>
        protected override IEnumerable<object> GetAtomicValues()
        {
            return new List<object>{
                Code,
                Street,
                Area,
                City,
                Province,
                Country,
                ZipCode,
                Detail,
                FullName
            };
            //return new List<object>{this};
        }
    }
}
